<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JSON字符串</title>
</head>
<body>
<script>
    let a = '{"username":"HalfQ", "password":"123456"}';
    document.writeln(a);
    let obj = JSON.parse(a);
    document.writeln(obj);
    document.writeln(obj.username);

    let b = {"username":"HalfQQ", "password":"123456"};
    document.writeln(""+b);
    let s = JSON.stringify(b);
    document.writeln(s);
</script>
</body>
</html>